/**
 * @file InetAddress.hh
 * @author zziywang (zziywang@163.com)
 * @brief { life is too short to learn cpp! }
 * @version 1.0
 * @date 2022-05-06
 *
 * @copyright Copyright (c) 2022
 *
 */

#pragma once

#include <arpa/inet.h>
#include <netinet/in.h>
#include <string>
using std::string;

namespace snow
{

class InetAddress
{
public:
    explicit InetAddress(unsigned short port);
    InetAddress(const string &ip, unsigned short port);
    InetAddress(const sockaddr_in &addr);

    string getIp() const; // IP
    unsigned short getPort() const;
    struct sockaddr_in *getAddr() { return &addr_; }

private:
    struct sockaddr_in addr_;
};

} // namespace snow
